<%@taglib uri="/struts-tags" prefix="s"%>
<script type="text/javascript" charset="utf-8"
	src="js/jquery.listnav.min-2.1.js"></script>
<script type="text/javascript" charset="utf-8"
	src="js/jquery.dataTables.listnav.js"></script>
<script type="text/javascript" charset="utf-8">
	$(document)
			.ready(
					function() {
						$("input[name=expressionOfInterest]")
								.click(
										function() {
											if ($(
													"input[name=expressionOfInterest]")
													.prop("checked")) {
												$("ul#organisation-tab")
														.append(
																"<li id='detail3'><a href='#2' data-toggle='tab'>Details 3</a></li>");
											} else {
												$("li#detail3").remove();
											}
										});
						//validate postcode
						var postcodes = new Array();
						
						$.ajax({
							url: 'checkPostCodeAjax.action',
							success: function(data){
								postcodes = data.postcodes;
							}
						});
						
						$("form#create-organisation").submit(function() {
							if (jQuery.trim($("input#postcode-id").val()).length == 0) {
								alert("Postcode cannot be null!");
								return false;
							} else {
								var flag = $.inArray($("input#postcode-id").val(), postcodes);
								if (flag == -1) {
									var r = confirm('Address Details cannot be confirmed - Do you wish to enter Unconfirmed Address Data?');
									if (r == true) {
										return true;
									} else {
										$("input#postcode-id").val("");
										$("input#postcode-id").focus();
										return false;
									}
								} else {
									return true;
								}
								return false;	
							}		
						});
				});
</script>
<s:if test="#session.logged != 'true'">
	<jsp:forward page="../index.jsp" />
</s:if>
<div class="content">
	<div class="row-fluid">
		<form id="create-organisation" action="createOrganisation.action" class='validate form-horizontal' method="post">
		<div class="span12">
			<div class="box">
				<div class="box-head tabs">
					<div style="width: 273px;">
						<h3>Book lesson</h3>
						<!-- <ul id="organisation-tab" class="nav nav-tabs" style="float: left; margin-top: 10px;">
							<li class='active'><a href="#0" data-toggle="tab">Details1</a></li>
							<li><a href="#1" data-toggle="tab">Details 2</a></li>										
 						</ul>	 -->										
					</div>
					
				</div>
				<div class="box-content" id="organisation">
					<div class="tab-content">
							<div class="row-fluid force-margin">
								<div class="span3">
								
								
								<!-- private String firstName;
								private String surName;
								private String account;
								private String password;
								private String email;
								private String phone;
								private String address;
								private String sex; -->
								
									<div class="control-group">
										<label for="firstName" class="control-label require">First Name</label>
										<div class="controls">
											<input type="text" name="firstName" id="firstName" class='required'>												
										</div>
									</div>
									<div class="control-group">
										<label for="surName" class="control-label require">Sur Name</label>
										<div class="controls">
											<input type="text" name="surName" id="surName" class='required'>												
										</div>
									</div>
									
									<div class="control-group">
										<label for="account" class="control-label require">Account</label>
										<div class="controls">
											<input type="text" name="account" id="account" class='input-medium input-square' value="">		
											<a class="" id="lookup-member" data-toggle="modal" href="#lookUpMember">Lookup</a>										
										</div>
									</div>
									
									<div class="control-group">
										<label for="password" class="control-label require">Password</label>
										<div class="controls">
											<input type="password" name="password" id="password" class='required'>												
										</div>
									</div>
									<div class="control-group">
										<label for="email" class="control-label">Email</label>
										<div class="controls">
											<input type="email" name="email" id="req">
										</div>
									</div>
									<div class="control-group">
										<label for="phone" class="control-label">Phone</label>
										<div class="controls">
											<input type="text" name="phone" id="phone">
										</div>
									</div>
									
									<div class="control-group">
										<label for="address" class="control-label">Address</label>
										<div class="controls">
											<input type="text" name="address" id="address">
										</div>
									</div>
									
									<div class="control-group">
										<label class="control-label" for="sex">Sex</label>
										<div class="controls">
											<label class="radio"><input type="radio" id="sex" name="sex">Male </label>
											<label class="radio"><input type="radio" id="sex" name="sex">Female </label>
										</div>
									</div>
									
								</div>
								<div class="span3">
									<div class="control-group">
										<label for="medium" class="control-label">Preferred
											Organisation</label>
										<div class="controls">											
											<s:checkbox name="preferredOrganisation" id="check" />
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Expression of
											Interest</label>
										<div class="controls">											
											<s:checkbox name="expressionOfInterest" />
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label require">Type of
											Business</label>
										<div class="controls">
											<input type="hidden" name="businessId" id="businessIdHidden"
												class='input-medium input-square' readonly="readonly"
												value=""> <input type="text" name="businessName"
												id="txtBussinessName" class='input-medium input-square'
												readonly="readonly" value="">
												<a id="look-up" data-toggle="modal" href="#lookUpBusiness">Lookup</a>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">SIC Code</label>
										<div class="controls">
											<input style="width: 50px;" type="text" name="sICCode"
												id="txtSICCode" class='input-medium input-square'
												readonly="readonly" value="">
										</div>
									</div>
									<div class="control-group">
										<label for="check" class="control-label">Organisation
											Full Description</label>
										<div class="controls">
											<textarea style="resize: none; width: 219px;"
												name="organisationFullDescription" id="basictext"
												class='span9 input-square' rows="6"></textarea>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label require">Phone Number</label>
										<div class="controls">
											<input type="text" name="phoneNumber" id="req"
												class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Fax</label>
										<div class="controls">
											<input type="text" name="fax" id="req" class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Email</label>
										<div class="controls">
											<input type="text" name="email" id="req" class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Web Address</label>
										<div class="controls">
											<input type="text" name="webAddress" id="req"
												class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Charity Number</label>
										<div class="controls">
											<input type="text" name="charityNumber" id="req"
												class='required'>
										</div>
									</div>
									<div class="control-group">
										<label for="req" class="control-label">Company Number</label>
										<div class="controls">
											<input type="text" name="companyNumber" id="req"
												class='required'>
										</div>
									</div>
								</div>
							</div>							
					</div>
				</div>
				<div class="row-fluid">
					<div class="span12">
						<div class="form-actions">
							<button class="btn btn-primary" type="submit">Save</button>
							<a id="hide-form" class='btn btn-danger'>Close</a>
						</div>
					</div>
				</div>
				
			</div>
		</div>
		</form>
	</div>
</div>

<div id="pageLookupMember"> 
	<%@ include file="lookupMember.jsp" %>
</div>
<div id="pageLookupLesson"> 
	<%@ include file="lookupLesson.jsp" %>
</div>
